package com.ywqf_api.common.redis.impl;

import java.util.concurrent.TimeUnit;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.stereotype.Component;

import com.ywqf_api.common.redis.CacheKeys;
import com.ywqf_api.common.redis.RedisClient;

@Component
public class RedisClientImpl implements RedisClient {

	@Autowired
	private ValueOperations<String, String> valueOps;
	
	@Override
	public void save(String value, long timeout, CacheKeys cacheKey, String prefix) {
		String key = cacheKey.name() + prefix;
		valueOps.set(key, value, timeout, TimeUnit.MINUTES);
	}

}
